import {webState} from "@/store/types";
export enum Theme {
    Light = 'light',
    Dark = 'dark'
}

const webConfig = defineStore('webConfig', {
    // 推荐使用 完整类型推断的箭头函数
    state: () : webState => {
        return {
            isDarkColor : 0,
            isOpenSideBar: true,
            isOpenLogin : false,
            isOpenAi: false,
        }
    },
    actions: {
        sideBarOpr() {
            this.isOpenSideBar = !this.isOpenSideBar;
        },
        loginOpr() {
            this.isOpenLogin = !this.isOpenLogin;
        },
        aiOpr() {
            this.isOpenAi = !this.isOpenAi;
        },
    },
    getters: {
        isHideSideBar() {
            return this.isOpenSideBar == false
        },
        isMobile(){
            const userAgent = navigator.userAgent.toLowerCase();
            if (userAgent.match(/(iphone|ipod|android|ios|ipad)/)) {
                return true;
            }
            return false;
        }
    },
})
export default webConfig
